/*
 * @lc app=leetcode.cn id=LCR 180 lang=cpp
 * @lcpr version=30204
 *
 * [LCR 180] 文件组合
 */

// @lcpr-template-start
using namespace std;
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
// @lcpr-template-end
// @lc code=start
class Solution
{
public:
    vector<vector<int>> fileCombination(int target)
    {
        int small = 1, big = 2;
        int mid = target / 2 + 1;
        int cursum = small + big;
        vector<vector<int>> res;
        while (small < mid)
        {
            if (cursum < target)
            {
                big++;
                cursum += big;
            }
            else if (cursum > target)
            {
                cursum -= small;
                small++;
            }
            else
            {
                vector<int> tmp;
                for (int i = small; i <= big; ++i)
                {
                    tmp.push_back(i);
                }
                res.push_back(tmp);
                cursum -=small;
                small++;
            }
        }
        return res;
    }
};
// @lc code=end

/*
// @lcpr case=start
// 12\n
// @lcpr case=end

// @lcpr case=start
// 18\n
// @lcpr case=end

 */
